import 'dart:ffi';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:mandoby/core/app_export.dart';
import 'package:mandoby/core/widgets/custom_bottom_bar.dart';
import 'package:mandoby/core/widgets/custom_elevated_button.dart';
import 'package:mandoby/core/widgets/custom_scaffold_widget.dart';
import '../../../../core/utils/app_colors.dart';
import '../../../../core/widgets/app_bar/custom_app_bar.dart';
import '../widgets/available_universite_container.dart';

class UniversitiesAvailableScreen extends StatefulWidget {
  const UniversitiesAvailableScreen({super.key});

  @override
  State<UniversitiesAvailableScreen> createState() => _UniversitiesAvailableScreenState();
}

class _UniversitiesAvailableScreenState extends State<UniversitiesAvailableScreen> {
  int itemCount=9;
  @override
  Widget build(BuildContext context) {
    return CustomScaffoldWidget(
        decoration: AppDecoration.gradientWhiteAToBlueGray,
        appBar: const CustomAppBar(),
        screenPadding: EdgeInsets.symmetric(horizontal: 16.h),
        body: ListView(
          children: [
            10.hs,
            Align(
              alignment: Alignment.center,
              child: Text(
                "الجامعات المتاحة للجنسية المختارة",
                style: CustomTextStyles.font24black800
                    ,
              ),
            ),
            10.hs,
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Image.asset("assets/images/kewait.png"),
                10.ws,
                Text(
                  "الكويت",
                  style: CustomTextStyles.font28whiteA700w800.copyWith(
                      color: AppColors.black900,),
                ),
              ],
            ),
            10.hs,
            GridView.builder(
              shrinkWrap: true,
              physics: NeverScrollableScrollPhysics(),
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 3,
                crossAxisSpacing: 3,
                mainAxisExtent: 200.h,
              ),
              itemBuilder: (context, index) {
                return const AvailableUniversityContainer().animate().flipH().flip();
              },
              itemCount: itemCount,
              scrollDirection: Axis.vertical,
            ),
            15.hs,
            CustomElevatedButton(text: "جامعات اخرى",onPressed: (){
              setState(() {
                itemCount=itemCount+3;
              });
            },
            margin: EdgeInsets.symmetric(horizontal: 70.w),
              height: 50.h,
            ),
            50.hs,
          ],
        ),
      navBar: CustomBottomBar(selectedIndex: 0),
    );
  }
}
